﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using WMSNet.Model.Models;
using System.Data.Entity.ModelConfiguration.Conventions;
using WMSNet.Data.Configuration;

namespace WMSNet.Data
{
    public class WMSNetEntities : DbContext
    {
        public WMSNetEntities()
        {
        }

        public virtual void Commit()
        {
            base.SaveChanges();
        }

        public DbSet<ItemData> ItemData { get; set; }
        public DbSet<ItemUnit> ItemUnit { get; set; }
        public DbSet<StockUnit> StockUnit { get; set; }
        public DbSet<AvisReq> AvisReq { get; set; }
        public DbSet<BOM> BOM { get; set; }
        public DbSet<CustomerOrder> CustomerOrder { get; set; }
        public DbSet<CustomerPos> CustomerPos { get; set; }
        public DbSet<FixAssgn> FixAssgn { get; set; }
        public DbSet<GoodsReceipt> GoodsReceipt { get; set; }
        public DbSet<GrrPosition> GrrPosition { get; set; }
      
        public DbSet<LocationCluster> LocationCluster { get; set; }
        public DbSet<OrderReceipt> OrderReceipt { get; set; }
        public DbSet<OrderReceiptPos> OrderReceiptPos { get; set; }
        public DbSet<OrderStrat> OrderStrat { get; set; }
        public DbSet<OutPos> OutPos { get; set; }
        public DbSet<OutReq> OutReq { get; set; }
        public DbSet<PickingOrder> PickingOrder { get; set; }
        public DbSet<PickingPos> PickingPos { get; set; }
        public DbSet<PickingUnitLoad> PickingUnitLoad { get; set; }
        public DbSet<PickReceipt> PickReceipt { get; set; }
        public DbSet<PickReceiptPos> PickReceiptPos { get; set; }
        public DbSet<Rack> Rack { get; set; }
        public DbSet<ReplenishOrder> ReplenishOrder { get; set; }
        //public DbSet<SequenceNumber> SequenceNumber { get; set; }
        public DbSet<ServiceConf> ServiceConf { get; set; }
        public DbSet<SlLabel> SlLabel { get; set; }
        public DbSet<StockRecord> StockRecord { get; set; }
        public DbSet<StockTaking> StockTaking { get; set; }
        public DbSet<StockTakingOrder> StockTakingOrder { get; set; }
        public DbSet<StockTakingRecord> StockTakingRecord { get; set; }
        public DbSet<StorageLocationType> StorageLocationType { get; set; }
        public DbSet<StorageReq> StorageReq { get; set; }
        public DbSet<Area> Area { get; set; }
        public DbSet<ClearingItem> ClearingItem { get; set; }
        public DbSet<Client> Client { get; set; }
        public DbSet<Document> Document { get; set; }
        public DbSet<LogItem> LogItem { get; set; }
        public DbSet<Lot> Lot { get; set; }
        public DbSet<PlugInConfig> PlugInConfig { get; set; }
        public DbSet<Request> Request { get; set; }
        public DbSet<Role> Role { get; set; }
        public DbSet<StorageLocation> StorageLocation { get; set; }
        public DbSet<StorageStrat> StorageStrat { get; set; }
        public DbSet<StorLoc> StorLoc { get; set; }
        public DbSet<SuLabel> SuLabel { get; set; }
        public DbSet<SysProp> SysProp { get; set; }
        public DbSet<TypeCapacityConstraint> TypeCapacityConstraint { get; set; }
        public DbSet<UlAdvice> UlAdvice { get; set; }
        public DbSet<UlAdvicePos> UlAdvicePos { get; set; }
        public DbSet<UnitLoad> UnitLoad { get; set; }
        public DbSet<UlRecord> UlRecord { get; set; }
        public DbSet<UnitLoadType> UnitLoadType { get; set; }
        public DbSet<User> User { get; set; }
        public DbSet<User_Role> User_Role { get; set; }
        public DbSet<WorkingArea> WorkingArea { get; set; }
        public DbSet<WorkingAreaPos> WorkingAreaPos { get; set; }
        public DbSet<Zone> Zone { get; set; }



        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);

            modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
            modelBuilder.Configurations.Add(new ItemUnitConfiguration());
            modelBuilder.Configurations.Add(new ItemDataConfiguration());
            modelBuilder.Configurations.Add(new StockUnitConfiguration());
            modelBuilder.Configurations.Add(new BOMConfiguration());
            modelBuilder.Configurations.Add(new CustomerOrderConfiguration());
            modelBuilder.Configurations.Add(new CustomerPosConfiguration());
            modelBuilder.Configurations.Add(new FixAssgnConfiguration());
            modelBuilder.Configurations.Add(new GoodsReceiptConfiguration());
            modelBuilder.Configurations.Add(new GrrPositionConfiguration());
            modelBuilder.Configurations.Add(new LocationClusterConfiguration());
            modelBuilder.Configurations.Add(new OrderReceiptConfiguration());
            modelBuilder.Configurations.Add(new OrderReceiptPosConfiguration());
            modelBuilder.Configurations.Add(new OrderStratConfiguration());
            modelBuilder.Configurations.Add(new OutPosConfiguration());
            modelBuilder.Configurations.Add(new OutReqConfiguration());
            modelBuilder.Configurations.Add(new PickingOrderConfiguration());
            modelBuilder.Configurations.Add(new PickingPosConfiguration());
            modelBuilder.Configurations.Add(new PickingUnitLoadConfiguration());
            modelBuilder.Configurations.Add(new PickReceiptConfiguration());
            modelBuilder.Configurations.Add(new PickReceiptPosConfiguration());
            modelBuilder.Configurations.Add(new RackConfiguration());
            modelBuilder.Configurations.Add(new ReplenishOrderConfiguration());
            //modelBuilder.Configurations.Add(new SequenceNumberConfiguration());
            modelBuilder.Configurations.Add(new ServiceConfConfiguration());
            modelBuilder.Configurations.Add(new SlLabelConfiguration());
            modelBuilder.Configurations.Add(new StockRecordConfiguration());
            modelBuilder.Configurations.Add(new StockTakingConfiguration());
            modelBuilder.Configurations.Add(new StockTakingOrderConfiguration());
            modelBuilder.Configurations.Add(new StockTakingRecordConfiguration());
            modelBuilder.Configurations.Add(new StorageReqConfiguration());
            modelBuilder.Configurations.Add(new AreaConfiguration());
            modelBuilder.Configurations.Add(new ClearingItemConfiguration());
            modelBuilder.Configurations.Add(new ClientConfiguration());
            modelBuilder.Configurations.Add(new DocumentConfiguration());
            modelBuilder.Configurations.Add(new LogItemConfiguration());
            modelBuilder.Configurations.Add(new LotConfiguration());
            modelBuilder.Configurations.Add(new PlugInConfigConfiguration());
            modelBuilder.Configurations.Add(new RequestConfiguration());
            modelBuilder.Configurations.Add(new RoleConfiguration());
            modelBuilder.Configurations.Add(new StorageLocationConfiguration());
            modelBuilder.Configurations.Add(new StorageLocationTypeConfiguration());
            modelBuilder.Configurations.Add(new StorageStratConfiguration());
            modelBuilder.Configurations.Add(new StorLocConfiguration());
            modelBuilder.Configurations.Add(new SuLabelConfiguration());
            modelBuilder.Configurations.Add(new SysPropConfiguration());
            modelBuilder.Configurations.Add(new TypeCapacityConstraintConfiguration());
            modelBuilder.Configurations.Add(new UlAdviceConfiguration());
            modelBuilder.Configurations.Add(new UlAdvicePosConfiguration());
            modelBuilder.Configurations.Add(new UnitLoadConfiguration());
            modelBuilder.Configurations.Add(new UlRecordConfiguration());
            modelBuilder.Configurations.Add(new UnitLoadTypeConfiguration());
            modelBuilder.Configurations.Add(new UserConfiguration());
            modelBuilder.Configurations.Add(new User_RoleConfiguration());
            modelBuilder.Configurations.Add(new WorkingAreaConfiguration());
            modelBuilder.Configurations.Add(new WorkingAreaPosConfiguration());
            modelBuilder.Configurations.Add(new ZoneConfiguration());
        }
    }

}
